package com.next

import grails.gorm.transactions.Transactional
import org.springframework.security.access.annotation.Secured

class RuleEngineProviderController
{
    def componentService

    @Secured(['ROLE_ADMINISTRATOR', 'ROLE_CUSTOMER_SERVICE_REPRESENTATIVE', 'ROLE_ACCOUNT_MANAGER', 'ROLE_COMPANY_ADMINISTRATOR', 'ROLE_PRODUCT_ADMINISTRATOR', 'ROLE_GENERAL_RISK_MANAGER', 'ROLE_BRANCH_GENERAL_MANAGER', 'ROLE_BRANCH_OFFICE_RISK_MANAGER', 'ROLE_HEAD_OFFICE_RISK_MANAGER', 'ROLE_GENERAL_MANAGER', 'ROLE_CRO', 'ROLE_CEO'])
    @Transactional
    def evaluate(Opportunity opportunity)
    {
        componentService.evaluate(Component.findByName("规则引擎（云丛）"), opportunity)
        redirect(controller: "opportunity", action: "show", params: [id: opportunity.id])
    }
}
